package com.ces.knacky.controller.tools;

import java.util.Date;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import com.ces.knacky.framework.controller.BaseController;
import com.ces.knacky.framework.model.IEntity;
import com.ces.knacky.model.Category;
import com.ces.knacky.model.Flag;
@Controller
public class SaveCategoryController extends BaseController {
	
	
	private String description;
	
	@RequestMapping ("/saveCategory.htm")	
	public String execute(){
		System.out.println("Inside Save Category");
		Category category = new Category();
		category.setDescription(description);
		IEntity entity = commonService.findFirstByDescription(Flag.class, "ACTIVE");
		category.setFlag((Flag)entity);
		commonService.add(category);
		return "saveCategory";
	}

	/**
	 * @return the description
	 */	
	public String getDescription() {
		return description;
	}

	/**
	 * @param description the description to set
	 */
	@ModelAttribute("description")
	public void setDescription(String description) {
		this.description = description;
	}




}
